var scene = new THREE.Scene();

{
  let geometry = new THREE.BufferGeometry();
  let vertices = new Float32Array([
    0,
    0,
    0, //顶点1坐标
    80,
    0,
    0, //顶点2坐标
    80,
    80,
    0, //顶点3坐标
    0,
    0,
    0, //顶点4坐标   和顶点1位置相同
    80,
    80,
    0, //顶点5坐标  和顶点3位置相同
    0,
    80,
    0, //顶点6坐标
  ]);
  let attribue = new THREE.BufferAttribute(vertices, 3);
  geometry.attributes.position = attribue;
  let normals = new Uint16Array([0, 1, 2, 0, 2, 3]);
  geometry.attributes.normal = new THREE.BufferAttribute(normals, 1);
  let material = new THREE.PointsMaterial({
    color: 0xff0000,
    size: 10,
  });
  let points = new THREE.Points(geometry, material);
  scene.add(points);
}
{
  let geometry = new THREE.Geometry();
  let p1 = new THREE.Vector3(0, 0, 0); //顶点1坐标
  let p2 = new THREE.Vector3(0, 100, 0); //顶点2坐标
  let p3 = new THREE.Vector3(50, 0, 0); //顶点3坐标
  let p4 = new THREE.Vector3(0, 0, 100); //顶点4坐标
  geometry.vertices.push(p1, p2, p3, p4);
  let face1 = new THREE.Face3(0, 1, 2);
  let n1 = new THREE.Vector3(0, 0, -1);
  let n2 = new THREE.Vector3(0, 0, -1);
  let n3 = new THREE.Vector3(0, 0, -1);
  face1.vertexNormals.push(n1, n2, n3);
  let face2 = new THREE.Face3(0, 2, 3);
  face2.normal = new THREE.Vector3(0, -1, 0);
  geometry.faces.push(face1, face2);
  let material = new THREE.PointsMaterial({
    color: 0x000000,
    size: 10,
    side: THREE.DoubleSide,
  });
  let points = new THREE.Points(geometry, material);
  scene.add(points);
}

//环境光
var ambient = new THREE.AmbientLight(0xffffff);
var width = window.innerWidth;
var height = window.innerHeight;
var k = width / height;
var s = 200; //物体远近
var camera = new THREE.OrthographicCamera(-s * k, s * k, s, -s, 1, 1000); //相机对象
camera.position.set(100, 300, 200); //相机位置
camera.lookAt(scene.position);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height);
renderer.setClearColor(0x00ff00, 1);
document.body.appendChild(renderer.domElement);
render();
function render() {
  renderer.render(scene, camera); //执行渲染操作
}
